package main

import "github.com/geetarista/go-bloomd/bloomd"
import "bufio"
import "os"
import "strings"
import "fmt"

func t() {
	filter := bloomd.Filter{Name: "123123"}
	client := bloomd.NewClient("10.14.1.32:8673")
	err := client.CreateFilter(&filter)
	if err != nil {
		panic(err)
	}
	filter.Clear()
	var keys []string
	scanner := bufio.NewScanner(os.Stdin)
	for scanner.Scan() {
		cmd := scanner.Text()
		if strings.Contains(cmd, "info") {
			fmt.Println(filter.Info())
			continue
		}
		if strings.Contains(cmd, "mul") {
			fmt.Println(keys)
			fmt.Println(filter.Multi(keys))
			continue
		}
		if strings.Contains(cmd, "show") {
			fmt.Println(keys)
			continue
		}
		keys = append(keys, cmd)
		if strings.Contains(cmd, "set") {
			filter.Bulk(keys)
			keys = make([]string, 0, 0)
		}
		if strings.Contains(cmd, "clear") {
			filter.Bulk(keys)
			filter.Clear()
			keys = make([]string, 0, 0)
		}
	}
}
func main() {
	t()
}
